@extends('admin::layouts.master')
@section('title')
    {{$title}}
@endsection
@css(css/goods.css)
<style type="text/css">
    
    .comment_list {
        padding-top:40px;
        /*width:700px;*/
        margin:0 auto;
    }
    .comment_details {
        float:left;
    }
    .comment_content {
        margin-top:10px;
        font-size:16px;
    }
    .comment_add_or_last {
        
        margin:0 auto;
        clear: both;
        width:600px;
        height:40px;
        background: #F0F0F0;
        text-align: center;
         line-height: 40px;   
    }
    .imgdiv{
        float:left;
 
    }
    .imgcss {
        width:50px;
        height:50px;
        border-radius: 50%;
    }
    .comment_name { 
        margin-left:10px;
        color:#3D9EEA;
        font-size:15px;
        font-weight: bolder;
    }
    .layui-icon {
        font-size: 10px; 
        color: grey;
    }
    .del {
        margin-left: 55px;
    }

</style>
@section('tab')
    <form class="layui-form">
    <div class="goods_fax">
        <div class="layui-row">
            <div class="layui-tab layui-tab-brief" lay-filter="filter">
                <div class="layui-tab-content">

                @if( $arr_search['act'] == 'ping')
    
                <div class="comment_list">
                    <h2 >全部评论</h2>
                    <hr>
                    <div>

                        @foreach( $data as $key=>$vo)
                            <div class="comment">
                                <div class="imgdiv"><img class="imgcss" src="{{$vo['to_user']['head_img']['full_src']}}"/></div>
                                <div class="conmment_details">
                                    <span class="comment_name">{{$vo['to_user']['nickname']}} </span>     <span>{{$vo['created_at']}}</span>
                                    <div class="comment_content" >  {{$vo['content']}}</div>
                                </div>
                                <hr>
                            </div>
                        @endforeach
                        @if(empty($data))
                            <td colspan="66" align="center">暂无评论数据</td>
                        @endif
                    </div>
                </div>


                    @else 
                        <div class="layui-card-body " style="overflow-x: auto;">
                        <table class="layui-table layui-form">
                            <thead>
                            <tr>
                                <th>编号</th>
                                <th>用户名</th>
                                <th>点赞时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach($data as $key=>$value)
                            <tr>
                                <td>{{ $value['id'] }}</td>
                                <td>{{ $value['to_user']['nickname'] }}</td>
                                <td>{{ $value['created_at'] }}</td>
                            </tr>
                            @endforeach
                            @if(empty($data))
                                <td colspan="66" align="center">暂无数据</td>
                            @endif
                            </tbody>
                        </table>
                    </div>
                    @endif
                    <div class="layui-card-body ">
                        <div class="page">
                            {{$page_link}}
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
@endsection

@section('tab_js')
    @include('admin::goods.this_js')
    <script>
        layui.use(['form', 'layer', 'jquery'], function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
                var is_submit = false;
                       //监听提交
            form.on('submit(add)', function (data) {
                if( is_submit ){
                    return false;
                }
                is_submit = true;
                $.ajax({
                    url: js_url('admin-discover-store'),
                    type: 'post',
                    data: data.field,
                    dataType: "json",
                    success: function (result) {
                        if (result.state === 0) {
                            layer.msg(result.msg, {time: 600, icon: 6}, function () {
                                // 可以对父窗口进行刷新
                                xadmin.father_reload();
                            });
                        } else {
                            is_submit = false;
                            layer.msg(result.msg, {time: 2000, icon: 5});
                        }
                    }
                });
                return false;
            });


        });
    </script>
@endsection




